/*     */ package com.jcrj.action.office;
/*     */ 
/*     */ import com.jcrj.action.BaseAction;
/*     */ import com.jcrj.entity.OMyTemplate;
/*     */ import com.jcrj.entity.OUser;
/*     */ import com.jcrj.service.ReportService;
/*     */ import java.io.PrintWriter;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ import javax.servlet.http.HttpServletResponse;
/*     */ import net.sf.json.JSONObject;
/*     */ 
/*     */ public class TemplateAction extends BaseAction
/*     */ {
/*     */   private ReportService reportService;
/*     */   private List<OMyTemplate> TemplateList;
/*     */   private List<Object> tempObjectList;
/*     */   private OMyTemplate oMyTemplate;
/*     */   private int templateId;
/*     */   private String[] ids;
/*     */   private String users;
/*     */   private String name;
/*     */   private String description;
/*     */   private String content;
/*     */   private long pageCount;
/*     */   private long totalCount;
/*     */   private String names;
/*     */ 
/*     */   public String templateList()
/*     */   {
/*  29 */     OUser user = (OUser)super.getSession().get("userInfo");
/*  30 */     this.TemplateList = this.reportService
/*  31 */       .getTemplateList(super.getCurrentPage(), 
/*  31 */       this.name, user.getId().intValue());
/*  32 */     for (int i = 0; i < this.TemplateList.size(); i++) {
/*  33 */       if ((((OMyTemplate)this.TemplateList.get(i)).getUserId() == null) || 
/*  34 */         ("".equals(((OMyTemplate)this.TemplateList.get(i)).getUserId()))) continue;
/*  35 */       ((OMyTemplate)this.TemplateList.get(i)).setUserList(
/*  36 */         this.reportService.getUserName(null, 
/*  37 */         ((OMyTemplate)this.TemplateList.get(i)).getUserId()));
/*     */     }
/*     */ 
/*  40 */     this.totalCount = this.reportService.countTemplate(this.name, user.getId().intValue()).longValue();
/*  41 */     this.pageCount = ((this.totalCount - 1L) / 10L + 1L);
/*  42 */     return "success";
/*     */   }
/*     */ 
/*     */   public String templateSave() {
/*  46 */     return "success";
/*     */   }
/*     */ 
/*     */   public String saveTemplate() {
/*     */     try {
/*  51 */       OUser user = (OUser)super.getSession().get("userInfo");
/*  52 */       this.reportService.saveTemplate(this.users, this.name, this.description, this.content, 
/*  53 */         user.getId().intValue(), user.getName());
/*  54 */       super.getResponse().getWriter().write("success");
/*  55 */       super.getResponse().getWriter().flush();
/*     */     } catch (Exception e) {
/*  57 */       e.printStackTrace();
/*     */       try
/*     */       {
/*  60 */         super.getResponse().getWriter().close();
/*     */       } catch (Exception e1) {
/*  62 */         e1.printStackTrace();
/*     */       }
/*     */     }
/*     */     finally
/*     */     {
/*     */       try
/*     */       {
/*  60 */         super.getResponse().getWriter().close();
/*     */       } catch (Exception e) {
/*  62 */         e.printStackTrace();
/*     */       }
/*     */     }
/*  65 */     return null;
/*     */   }
/*     */ 
/*     */   public String daleteTemplate() {
/*     */     try {
/*  70 */       this.reportService.deleteTemplate(this.ids);
/*  71 */       super.getResponse().getWriter().write("success");
/*  72 */       super.getResponse().getWriter().flush();
/*     */     } catch (Exception e) {
/*  74 */       e.printStackTrace();
/*     */       try
/*     */       {
/*  77 */         super.getResponse().getWriter().close();
/*     */       } catch (Exception e1) {
/*  79 */         e1.printStackTrace();
/*     */       }
/*     */     }
/*     */     finally
/*     */     {
/*     */       try
/*     */       {
/*  77 */         super.getResponse().getWriter().close();
/*     */       } catch (Exception e) {
/*  79 */         e.printStackTrace();
/*     */       }
/*     */     }
/*  82 */     return null;
/*     */   }
/*     */ 
/*     */   public String templateUpdate() {
/*  86 */     this.oMyTemplate = this.reportService.getTemplateNew(this.templateId);
/*  87 */     this.oMyTemplate.setUserList(this.reportService
/*  88 */       .getUserName(null, 
/*  88 */       this.oMyTemplate.getUserId()));
/*  89 */     this.names = "";
/*  90 */     for (int i = 0; i < this.oMyTemplate.getUserList().size(); i++) {
/*  91 */       if (this.names == "")
/*  92 */         this.names += ((OUser)this.oMyTemplate.getUserList().get(i)).getName();
/*     */       else {
/*  94 */         this.names = (this.names + "," + ((OUser)this.oMyTemplate.getUserList().get(i)).getName());
/*     */       }
/*     */     }
/*  97 */     return "success";
/*     */   }
/*     */ 
/*     */   public String getTemplate() {
/*     */     try {
/* 102 */       super.getResponse().setCharacterEncoding("UTF-8");
/* 103 */       OUser user = (OUser)super.getSession().get("userInfo");
/* 104 */       this.tempObjectList = this.reportService.getOMyTemplateList(1, user.getId().intValue());
/* 105 */       JSONObject json = new JSONObject();
/* 106 */       json.put("tempObjectList", this.tempObjectList);
/* 107 */       super.getResponse().getWriter().write(json.toString());
/* 108 */       super.getResponse().getWriter().flush();
/*     */     } catch (Exception e) {
/* 110 */       e.printStackTrace();
/*     */       try
/*     */       {
/* 113 */         super.getResponse().getWriter().close();
/*     */       } catch (Exception e1) {
/* 115 */         e1.printStackTrace();
/*     */       }
/*     */     }
/*     */     finally
/*     */     {
/*     */       try
/*     */       {
/* 113 */         super.getResponse().getWriter().close();
/*     */       } catch (Exception e) {
/* 115 */         e.printStackTrace();
/*     */       }
/*     */     }
/* 118 */     return null;
/*     */   }
/*     */ 
/*     */   public ReportService getReportService()
/*     */   {
/* 123 */     return this.reportService;
/*     */   }
/*     */ 
/*     */   public void setReportService(ReportService reportService) {
/* 127 */     this.reportService = reportService;
/*     */   }
/*     */ 
/*     */   public List<OMyTemplate> getTemplateList() {
/* 131 */     return this.TemplateList;
/*     */   }
/*     */ 
/*     */   public void setTemplateList(List<OMyTemplate> templateList) {
/* 135 */     this.TemplateList = templateList;
/*     */   }
/*     */ 
/*     */   public OMyTemplate getOMyTemplate() {
/* 139 */     return this.oMyTemplate;
/*     */   }
/*     */ 
/*     */   public void setOMyTemplate(OMyTemplate myTemplate) {
/* 143 */     this.oMyTemplate = myTemplate;
/*     */   }
/*     */ 
/*     */   public String getUsers() {
/* 147 */     return this.users;
/*     */   }
/*     */ 
/*     */   public void setUsers(String users) {
/* 151 */     this.users = users;
/*     */   }
/*     */ 
/*     */   public String getName() {
/* 155 */     return this.name;
/*     */   }
/*     */ 
/*     */   public void setName(String name) {
/* 159 */     this.name = name;
/*     */   }
/*     */ 
/*     */   public String getDescription() {
/* 163 */     return this.description;
/*     */   }
/*     */ 
/*     */   public void setDescription(String description) {
/* 167 */     this.description = description;
/*     */   }
/*     */ 
/*     */   public String getContent() {
/* 171 */     return this.content;
/*     */   }
/*     */ 
/*     */   public void setContent(String content) {
/* 175 */     this.content = content;
/*     */   }
/*     */ 
/*     */   public long getPageCount() {
/* 179 */     return this.pageCount;
/*     */   }
/*     */ 
/*     */   public void setPageCount(long pageCount) {
/* 183 */     this.pageCount = pageCount;
/*     */   }
/*     */ 
/*     */   public long getTotalCount() {
/* 187 */     return this.totalCount;
/*     */   }
/*     */ 
/*     */   public void setTotalCount(long totalCount) {
/* 191 */     this.totalCount = totalCount;
/*     */   }
/*     */ 
/*     */   public String[] getIds() {
/* 195 */     return this.ids;
/*     */   }
/*     */ 
/*     */   public void setIds(String[] ids) {
/* 199 */     this.ids = ids;
/*     */   }
/*     */ 
/*     */   public int getTemplateId() {
/* 203 */     return this.templateId;
/*     */   }
/*     */ 
/*     */   public void setTemplateId(int templateId) {
/* 207 */     this.templateId = templateId;
/*     */   }
/*     */ 
/*     */   public String getNames() {
/* 211 */     return this.names;
/*     */   }
/*     */ 
/*     */   public void setNames(String names) {
/* 215 */     this.names = names;
/*     */   }
/*     */ 
/*     */   public List<Object> getTempObjectList() {
/* 219 */     return this.tempObjectList;
/*     */   }
/*     */ 
/*     */   public void setTempObjectList(List<Object> tempObjectList) {
/* 223 */     this.tempObjectList = tempObjectList;
/*     */   }
/*     */ }

/* Location:           /Volumes/work/oa/WEB-INF/classes/
 * Qualified Name:     com.jcrj.action.office.TemplateAction
 * JD-Core Version:    0.6.0
 */